package com.linsy.product.redis.mq.service;

import com.linsy.product.redis.mq.entity.MqDataEntity;
import com.linsy.product.redis.mq.entity.MqTaskKeyConstant;
import com.linsy.product.redis.mq.entity.PutMsgDTO;
import com.linsy.product.redis.mq.util.RedisUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.LinkedList;
import java.util.List;

/**
 * 把消息丢到队列的方法
 */
@Component
@RequiredArgsConstructor
public class Broker {

    private final RedisUtil redisUtil;

    protected void pullType(String key, List<MqDataEntity> entityList) {
        redisUtil.rPush(new PutMsgDTO(MqTaskKeyConstant.MQ_KEY + key, new LinkedList<>(entityList)));
    }

}
